import React, { memo, useState, useEffect } from "react";
// import { useSelector, shallowEqual, useDispatch } from "react-redux";
// import { getDetailsAction } from '../home/store/actionCreators'
import { scrollTo } from "../../utils/scrollTo";
import { selectNewsFIRST } from '../../services/home'
import css from './css.module.scss'
export default memo(function NewsDetails(props) {
    scrollTo(0, 800);
    const { search } = props.location
    let newsId = search.split('?')[1]
    newsId = newsId.split('=')[1]
    const [newsDetails, setNewsDetails] = useState({})
    useEffect(() => {
        selectNewsFIRST({ newsId: newsId }).then(res => {
            setNewsDetails(res.data)
        })
    }, [newsId]);
    return (
        <div className='w ptb60'>
            <div className={css.title}>
                {newsDetails.title}
            </div>

            <div className={css.nav_title}>
                时间：{newsDetails.updateTime} 来源：{newsDetails.subhead}
            </div>
            <div className='rech_text' dangerouslySetInnerHTML={{ __html: newsDetails.content }}>
            </div>
        </div>
    );
});
